<?php

namespace app\common\model;

use think\Model;
use traits\model\SoftDelete;

class Overhaul extends Model
{

    use SoftDelete;

    

    // 表名
    protected $name = 'overhaul';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [

    ];


    public function geImageAttr($value, $data)
    {
        var_dump($value);
        $value = $value ? $value : (isset($data['image'])&&$data['image'] ?$data['image']  : 'avatar.png');
        return get_app_image_url($value);
    }







    public function category()
    {
        return $this->belongsTo('Category', 'category_id2', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
